home *** CD-ROM | disk | FTP | other *** search
- Path: bln.sel.alcatel.de!furguson
- From: furguson@bln.sel.alcatel.de (Marc Furguson)
- Newsgroups: comp.lang.c++
- Subject: Re: Coding Standards
- Date: 26 Mar 1996 13:45:19 GMT
- Organization: Alcatel SEL AG Berlin
- Message-ID: <4j8sdf$575@slbh00.bln.sel.alcatel.de>
- References: <4hj8ek$elu@sam.inforamp.net> <4hktar$5o2@galaxy.ucr.edu> <4io1a4$n9v@sam.inforamp.net>
- NNTP-Posting-Host: slbh37.bln.sel.alcatel.de
- X-Newsreader: TIN [version 1.2 PL2]
-
- Randy Charles Morin (rmorin@inforamp.net) wrote:
- : In article <CBARBER.96Mar18104644@figaro.bbn.com>,
- : cbarber@bbn.com (Christopher Barber) wrote:
- --- snip ---
- : > Randy> -a class which can be instantiated with a "new" must have a
- : > Randy> copy constructor, a destructor and an assignment operator
- : > Randy> definition. Most compilers (if not all) supply default copy
- : > Randy> construtors. Unless you think your class may have copy behavior
- : > Randy> problems, then writing copy constructors is redundant. When you
- : > Randy> have 100+ classes to write and where the average copy
- : > Randy> constructor has 50 lines, you would need 100 hours to write the
- : > Randy> additional robustness (or cumbersomeness).
- : >Aren't you getting a bit extreme here? I have written hundreds of
- : >copy constructors and only a handful came even close to 50 lines long.
- : >Yes, the compiler will generate a copy constructor for you, but it
- : >has the wrong behavior in many cases.
-
- : Where am I being a little extreme? We do have 100+ classes, I have already
- : identified about 100. I calculated the average amount of lines per copy
- : constructor in another project and it came out just below 50. The average
- : programmer on that project wrote less than 50 lines an hour. That's 100
- : hours. It's math.
- --- snip ---
- : Agrivar
-
- Seems reasonable to me. It's not just a case of typing in copy constructors,
- destructors etc. If the compiler does it just fine then let it. If you need
- something else then code it, test it and document it. Now, maybe I'm just
- slow but I take a *lot* longer to test and document my software than I
- take to write it, so I'd rather not write it in the first place if I
- don't have to! On the other hand if your code is completely self-
- documenting and is *always* faultless then just keep bashing away!
- --
- +-----------------+--------------------------+
- | Mark Ferguson | Alcatel SEL AG Berlin |
- | | Mobile Comms Division |
- | aka | Colditzstrasse 34-36 |
- | Marc Furguson | D 12099 Berlin Germany |
- +-----------------+--------------------------+
-